@model Boolean?

@{
    var htmlAttributes = new ViewDataDictionary();
    if (ViewBag.@class != null)
    {
        htmlAttributes.Add("class", ViewBag.@class);
    }
}

<div class="form-group">
    @Html.LabelFor(m => m, new { @class = "col-sm-2 control-label" })
    <div class="col-sm-1">
        @Html.CheckBox(
            "",
            Model.HasValue && Model.Value,
            htmlAttributes)
        @Html.ValidationMessageFor(m => m, null)
    </div>
</div>
